package org.broadway.interfaces;

import org.broadway.exceptions.EvaluationException;

/***
 * The evaluator compoment is intended to evaluate resources using arbitrary rules.
 * Implement this interface to create components that can evaluates rules which
 * can trigger actions based predefined conditions.
 * <br/><br/>
 * The expression may be a literal or a strongly typed object.  The 
 * interface is parameterized to allow implementors maximum flexibility.
 * 
 * @author vmatters
 *
 * @param <RESULT_TYPE> - The result evaluated by the evaluator.
 * @param <EXPRESSION_TYPE> - An expression object to be evaluated.
 */
public interface Evaluator <RESULT_TYPE, EXPRESSION_TYPE>{
	/**
	 * The evaluate() method resolves the provided expression and returns a result.
	 * The parameterized implementation allows specification of concrete types for 
	 * the expression and the result.
	 * <br/><br/>
	 * Throws a runtime EvaluationException if there's problem evaluating the expression.
	 * 
	 * @param exp the expression to evaluate.
	 * @return RESULT_TYPE is the result of the evaluation.
	 * @throws EvaluationException thrown if there is a problem.
	 */
	public RESULT_TYPE evaluate(EXPRESSION_TYPE exp) throws EvaluationException;
}
